<script type="text/javascript">
    var intro = null, background = null;

    _this.onLoad(function () {
        var success = function () {
            /*
             *@Mute 
             */
            if (intro == null) {
                intro = new GvAudio(_this.Base_Upload + Program.sound_welcome, false);// nhạc chương trình
            }
            if (background == null) {
                background = new GvAudio(_this.Base_Upload + Program.sound_bg, true); // nhạc nền
            }

            intro.onended(function () {
                background.play();
                background.onended();
            });



            if (_this.storage.get("mute") == "stop") {
                $("#page_indexindex .Mute").addClass("stop");
                intro.pause();
                background.pause();
            } else {
                intro.play();
            }
            $("#page_indexindex .Mute").off("tap");
            $("#page_indexindex .Mute").on("tap", function () {
                if (!$(this).hasClass('stop')) {
                    if (intro != null)
                        intro.pause();

                    if (background != null)
                        background.pause();

                    $(".Mute").addClass('stop');
                    _this.storage.set("mute", "stop");
                } else {
                    background.play();
                    $(".Mute").removeClass('stop');
                    _this.storage.set("mute", "play");
                }
                return false;
            });

            //End mute

            Template.isLoaded = true;

            function active_question() {
                var Data = Program.LastQuestion.data();
                Program.activeContent(Data);
                Program.LastResult.remove();
                new Popup().close();
            }
//            if (Program.LastQuestion.isExist()) {
//                active_question();
//            }
            $("#page_indexindex .Header_text").UI_AddClassHover("hover");
            $("#page_indexindex .Header_text").off("tap");
            $("#page_indexindex .Header_text").on("tap", function () {
                Program.id_tvshow = 0;
                intro.stop();
                background.stop();
                intro = null;
                background = null;
                Toast.close();
                socket.io.disconnect();
                _this.redirect("index/home?back=true");
                refreshSlide();
                //Load slider trang chủ
                /*$(".RefreshSlider").addClass("loading");
                 $(".Slide").addClass("empty");
                 
                 loadSlide(function () {
                 setTimeout(function () {
                 $(".RefreshSlider").removeClass("loading");
                 }, 1000);
                 });*/
            });
        };

        var error = function () {
            Template.isLoaded = false;
        };

        if (Program.id_tvshow > 0) {
            setTimeout(success, 200);
            //Template.get(success, error);
        }
    });
</script>
<div class="UI_Body FadeIn">
    <div class="Inner Scroller">
        <div class="Scroller_Inner">
        </div>
    </div>
</div>
<div class="UI_Footer">
    <a class="Mute"></a>
    <p>Sản phẩm của <img src="public/images/vtv-digital.png" alt=""/></p>
</div>